﻿namespace LocalTest.Application.Contracts.Shared;

public enum ResponseType
{
    Success,
    Error,
}

public record ResponseResult(ResponseType type = ResponseType.Success)
{
    public int Code { get; init; } = type switch
    {
        ResponseType.Success => 20000,
        ResponseType.Error => 40000,
        _ => 20000,
    };

    public object? Data { get; init; } = type switch
    {
        ResponseType.Error => new object(),
        _ => null,
    };

    public string Msg { get; init; } = type switch
    {
        ResponseType.Success => "操作成功",
        ResponseType.Error => "操作失败",
        _ => "操作成功",
    };

    public string Status { get; init; } = type switch
    {
        ResponseType.Success => "success",
        ResponseType.Error => "error",
        _ => "success",
    };
}